package net.neptech.service.impl;

import net.neptech.model.appointment.MedicalCase;
import net.neptech.repository.MedicalCaseRepository;
import net.neptech.service.MedicalCaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: liyuxiang
 * @Date: 2025/8/23 13:31
 * @Description: TODO
 */
@Service
public class MedicalCaseServiceImpl implements MedicalCaseService {
    @Autowired
    private MedicalCaseRepository medicalCaseRepository;

    @Override
    public List<MedicalCase> list(Long[] deptIds) {
        //根据科室ids查询所有病例
        if (deptIds == null || deptIds.length == 0) {
            return medicalCaseRepository.findAll();
        }
        return medicalCaseRepository.findAllByDeptIdIn(List.of(deptIds));
    }

    @Override
    public void add(MedicalCase medicalCase) {
        medicalCaseRepository.save(medicalCase);
    }
}
